import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux'
import { createStore } from 'redux'
import reducer from './reducers'

import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';


const store = createStore( reducer )

store.subscribe(() =>
  localStorage.setItem( 'todos', JSON.stringify( store.getState().todos ) )
);

// console.log( store )

ReactDOM.render(
    <Provider store={store} >
        <App />
    </Provider>,
    document.getElementById('root')
);

registerServiceWorker();
